package net.wangds.data.impl;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import net.wangds.data.Tree;

import javax.persistence.Column;
import javax.persistence.Lob;
import javax.persistence.MappedSuperclass;
import javax.persistence.Transient;
import java.util.ArrayList;
import java.util.List;

@NoArgsConstructor
@MappedSuperclass
public class DefaultTree<T extends Tree<String, T>> extends IdCreate implements Tree<String, T> {

    private static final long serialVersionUID = 0;
    /**
     * 父节点id.
     */
    @Getter
    @Setter
    @Column(length = 36)
    private String parentId;

    @Getter
    @Setter
    @Transient
    private List<T> children = new ArrayList<>(2);


    /**
     * 职位完整从属关系.
     */
    @Getter
    @Setter
    @Lob
    @Column(columnDefinition="text")
    private String branchPath;

}
